/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

/**
 * <p>Project: app2022 - Format1
 * <p>Powered by webrx On 2022-01-05 11:24:23
 * <p>Created by IntelliJ IDEA
 *
* @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Format1 {
    public static void main(String[] args) {
        String name = "李四";
        int age = 18;
        String addr = "河南省郑州市道学大道28号";
        System.out.println("姓名：" + name + "，年龄：" + age + "岁，家庭地址：" + addr);
        //System.out.printf("姓名：%s，年龄：%d岁，家庭地址：%s%n", name, age, addr);
        String str = String.format("姓名：%s，年龄：%d岁，家庭地址：%s%n", name, age, addr);
        System.out.println(str);

        //%s 字符串
        //%d 十进制整数
        System.out.printf("%06d%n", 1);
        System.out.printf("%6d%n", 12);
        System.out.printf("%6d%n", 100);
        //%f
        System.out.printf("%f%n", 1.2);
        System.out.printf("%.2f%n", 1.2);
        System.out.printf("%.2f%n", 3f);

        System.out.printf("%.2f%n", .25);

        System.out.printf("%tF %<tT%n", System.currentTimeMillis());

        System.out.printf("%d\t%4$03d\t %1$05d", 10, 100, 6, 7, 10);
    }
}
